<script type="text/javascript">
	$(function(){
		var width = 200;
		$('#board-image ul').each(function(){
			var count = $(this).find('li').length;
			$(this).css('width',width*count);
		})
		
		$('.tbexecutive tr').each(function(){
			var area = $(this).find('td:eq(2)').text();
			var area2 = $(this).next().find('td:eq(2)').text();
			if(area==area2)
			{
				$(this).find('td').css('border','none');
			}
		})
	})
</script>

<div class="executive-link">
		<a href="boards/index/main/2"><img width="177" height="23" src="themes/default/images/executives_1.png"></a>
      	<a href="boards/index/main/4"><img width="91" height="23" src="themes/default/images/executives_2.png"></a>
      	<a href="boards/index/main/3"><img width="204" height="23" src="themes/default/images/executives_3.png"></a>
      	<a href="boards/index/main/1"><img width="168" height="23" src="themes/default/images/executives_4.png"></a>
</div>
<?php
		$col = 1;
		$row = 1;
	?>
	<?php if($group->id<>1): ?>
<div id="board-image" style="padding-bottom:50px;">
			<ul>
			<?php foreach($boards as $content): ?>
				<?php if(($content->row)&&($content->col)): ?>
				<?php echo ($row<>$content->row)?'<div class="clear"></div></ul><ul>':'' ?>
				<li>
				<?php if(is_file('uploads/board/'.$content->image)): ?>
				<img src="uploads/board/<?php echo $content->image; ?>" /><br />
				<?php else: ?>
				<img src="themes/default/images/img.jpg" /><br />
				<?php endif; ?>
				<?php echo $content->firstname.' '.$content->lastname ?><br />
				<?php echo $content->position ?>
				</li>
				<?php $row = $content->row; ?>
				<?php endif; ?>
			<?php endforeach; ?>
			<div class="clear"></div>
			</ul>
		<div class="clear"></div>
	</div>
<?php endif; ?>
<div class="executive-search" style="display:none;">
	<form method="get">
	<img width="40" height="44"  src="themes/default/images/ico_search2.png">
      <input type="text" style="width:350px; height:25px;" name="name">
      ปีงบประมาณ 
       
		<?php echo form_dropdown('year',range(2550,date('Y')+543),@$_GET['year'],'style="width:70px; padding:5px;"') ?>
	<input type="image" src="themes/default/images/btn_search.png" style="position:relative; top:6px;" />
	</form>
</div>

<div class="box">
	<h1 class="<?php echo $color[$group->id] ?>">
		<img src="uploads/icon/head/jd.png" />
		<span><?php echo $group->name ?></span>
		<div class="corner_left"></div>
		<div class="corner_right"></div>
	</h1>
<div class="view">
	<?php if($group->id<>1): ?>
	<table class="tbexecutive">
	<tr>
		<th>รูป</th>
		<th>ชือ - นามสกุล</th>
		<th>เขตตรวจ</th>
		<th>โทรศัพท์</th>
		<th>มือถือ</th>
		<th>โทรสาร</th>
	</tr>
	<?php foreach($contents as $content): ?>
	<tr>
		<?php if((is_file('uploads/board/'.$content->image))&&($content->image)): ?>
		<td><img src="uploads/board/<?php echo $content->image; ?>" /></td>
		<?php else: ?>
		<td><img src="themes/default/images/img.jpg" /></td>
		<?php endif; ?>
		<td>
			<?php echo $content->firstname.' '.$content->lastname; ?>
			<?php if(($group->id==2)||($group->id==4)): ?>
			<br />ตำแหน่ง <?php echo $content->position ?>	
			<?php endif; ?>
		</td>
		<td><?php echo ($content->area==0)?'กรุงเทพฯ':$content->area; ?></td>
		<td><?php echo $content->telephone; ?></td>
		<td><?php echo $content->mobile; ?></td>
		<td><?php echo $content->fax; ?></td>
	</tr>
	<?php endforeach; ?>
	</table>
	<?php echo $contents->pagination() ?>
	<?php else: ?>
	<?php
		$col = 1;
		$row = 1;
	?>
	<div id="board-image">

			<ul>
			<?php foreach($contents as $content): ?>
				<?php echo ($row<>$content->row)?'<div class="clear"></div></ul><ul>':'' ?>
				<li>
				<?php if(is_file('uploads/board/'.$content->image)): ?>
				<img src="uploads/board/<?php echo $content->image; ?>" /><br />
				<?php else: ?>
				<img src="themes/default/images/img.jpg" /><br />
				<?php endif; ?>
				<?php echo $content->firstname.' '.$content->lastname ?><br />
				<?php echo $content->position ?>
				</li>
				<?php $row = $content->row; ?>
			<?php endforeach; ?>
			<div class="clear"></div>
			</ul>
		<div class="clear"></div>
	</div>
	<?php endif; ?>
</div>



</div>

<div class="executive-link">
		<a href="boards/index/main/2"><img width="177" height="23" src="themes/default/images/executives_1.png"></a>
      	<a href="boards/index/main/4"><img width="91" height="23" src="themes/default/images/executives_2.png"></a>
      	<a href="boards/index/main/3"><img width="204" height="23" src="themes/default/images/executives_3.png"></a>
      	<a href="boards/index/main/1"><img width="168" height="23" src="themes/default/images/executives_4.png"></a>
</div>